<?php
// +----------------------------------------------------------------------
// | KITEGO-Admin「开箱即用」「人人全栈」
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2024 https://www.kitego.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed KITEGO并不是自由软件，未经许可不能去掉KITEGO相关版权
// +----------------------------------------------------------------------
// | Author: KITEGO Team <bd@kitego.cn>
// +----------------------------------------------------------------------

namespace app\adminapi\validate\setting;

use think\Validate;

class SystemRoleValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'alias|角色别名' => 'require|in:super,admin,staff',
        'label|角色名称' => 'require',
        'remark|角色备注' => 'require',
        'sort|角色排序值' => 'require|number',
        'status|角色开启状态' => 'require|number',
        'deleteFlag|角色删除标识' => 'require|in,0,1',
        'ids|批量删除ids' => 'require|array',
        'roleId|角色id' => 'require|number'
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'alias.in' => '角色标识必须是super,admin,staff其中一个'
    ];

    /**
     * 验证场景定义
     * @var array
     */
    protected $scene = [
        'editSystemRole' => ['alias', 'label', 'remark', 'sort', 'status'],
        'batchDelSystemRole' => ['ids'],
        'getRoleMenuIds' => ['roleId']
    ];
}
